package com.eltsistemas.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import br.com.graficafuxico.modelo.Album;
import br.com.graficafuxico.modelo.Blog;
import br.com.graficafuxico.modelo.Comentario;
import br.com.graficafuxico.modelo.Foto;
import br.com.graficafuxico.modelo.Usuario;

@SuppressWarnings("deprecation")
public class HibernateUtil {
	
	private static SessionFactory factory;
	
	static {

		AnnotationConfiguration cfg = new AnnotationConfiguration();
		
		cfg.addAnnotatedClass(Album.class);
		cfg.addAnnotatedClass(Blog.class);
		cfg.addAnnotatedClass(Comentario.class);
		cfg.addAnnotatedClass(Foto.class);
		cfg.addAnnotatedClass(Usuario.class);
		
		
		factory = cfg.buildSessionFactory();

	}
	
	public Session getSession()
	{
		return factory.openSession();
	}
	
}
